home *** CD-ROM | disk | FTP | other *** search
/ Micromanía 90 / CDMM_90_1.ISO / Industry Giant 2 / ig2_setup_demo.exe / 00_02_TUTORIAL 3_1900.TXT < prev    next >
Encoding:
Text File  |  2002-05-23  |  23.5 KB  |  929 lines

  1. // ============================================================================
  2. // TUTORIAL 2
  3. // 
  4. // The script implements tutorial nr 2.
  5. //
  6. // Topic :
  7. //     - Building complex production
  8. //  - Playing with production parameters
  9. // ============================================================================
  10.  
  11. // ============================================================================
  12. // VARIABLES
  13. // ============================================================================
  14.     
  15. [VARIABLES]
  16.     
  17.     // Parameter variables.
  18.     ReturnState$
  19.     FirstTutorialTextID
  20.     LastTutorialTextID
  21.     TutorialTextID
  22.  
  23.     // Helper variables.
  24.     Local_i
  25.  
  26.     // Building IDs
  27.     Storage1ID
  28.     Storage2ID
  29.     Storage3ID
  30.     Storage4ID
  31.     Station1ID
  32.     Station2ID
  33.     Station3ID
  34.     Station4ID
  35.     Station5ID
  36.     Station6ID
  37.  
  38. // ============================================================================
  39. // INIT
  40. // ============================================================================
  41. [STATE Load]
  42.  
  43.     LoadGame("missions\\00_02_Tutorial 3_1900.ig2")
  44.     LoadMissionConfig("missions\\00_02_Tutorial 3_1900.mis")
  45.     SetOutputMode(2)
  46.     SetMsgFilter(65535)
  47.     StartCommandFiltering()
  48.     ControlBar.SetDisable(871)
  49.     DialogControl.SetDisable(16)
  50.     Storage1ID = 252
  51.     Storage2ID = 108
  52.     SetState("Intro")
  53.  
  54. // ============================================================================
  55. // INTRO
  56. // ============================================================================
  57. [STATE Intro]
  58.  
  59.  
  60.     FirstTutorialTextID = 500
  61.     LastTutorialTextID  = 501
  62.     ReturnState = 'BuildStation1'
  63.     SetState("Show_tutorial_text_serie")
  64.  
  65.  
  66. // ============================================================================
  67. // BuildStation1
  68. // ============================================================================
  69. [STATE BuildStation1]    
  70.     TutorialTextID = 503
  71.     ReturnState = 'WaitForStation1'
  72.     SetState("Show_tutorial_text")
  73.  
  74. [STATE WaitForStation1]    
  75.     IF IsEnterState
  76.     THEN
  77.         ClearCommandQueue()
  78.     END
  79.  
  80.     // Is there a queued command ? 
  81.     IF GetCommandQueueLength() > 0
  82.     THEN
  83.         IF NextCommand.GetType() == 9 AND
  84.             NextCommand.GetInternType() == 3
  85.         THEN    
  86.             SetState("VerifyStation1Location")
  87.         ELSE
  88.             NextCommand.Cancel()
  89.             ClearCommandQueue()
  90.             SetState("BuildStation1")
  91.         END
  92.     END
  93.  
  94. [STATE VerifyStation1Location]
  95.     IF IsHighlighted(Storage1ID)
  96.     THEN
  97.         NextCommand.Run()
  98.         Station1ID = User.GetLastBuildingBuilt()
  99.         ClearCommandQueue()
  100.         SetState("BuildStation2")
  101.     ELSE
  102.         TutorialTextID = 600
  103.         ReturnState = 'WaitForStation1'
  104.         SetState("Show_tutorial_text")
  105.     END
  106.  
  107. // ============================================================================
  108. // BuildStation2
  109. // ============================================================================
  110. [STATE BuildStation2]    
  111.     TutorialTextID = 506
  112.     ReturnState = 'WaitForStation2'
  113.     SetState("Show_tutorial_text")
  114.  
  115. [STATE WaitForStation2]    
  116.     IF IsEnterState
  117.     THEN
  118.         ClearCommandQueue()
  119.     END
  120.  
  121.     // Is there a queued command ? 
  122.     IF GetCommandQueueLength() > 0
  123.     THEN
  124.         IF NextCommand.GetType() == 9 AND
  125.             NextCommand.GetInternType() == 3
  126.         THEN    
  127.             SetState("VerifyStation2Location")
  128.         ELSE
  129.             NextCommand.Cancel()
  130.             ClearCommandQueue()
  131.             SetState("BuildStation2")
  132.         END
  133.     END
  134.  
  135. [STATE VerifyStation2Location]
  136.     IF IsHighlighted(Storage2ID)
  137.     THEN
  138.         NextCommand.Run()
  139.         Station2ID = User.GetLastBuildingBuilt()
  140.         ClearCommandQueue()
  141.         SetState("ConnectStations")
  142.     ELSE
  143.         TutorialTextID = 600
  144.         ReturnState = 'WaitForStation2'
  145.         SetState("Show_tutorial_text")
  146.     END
  147.  
  148. // ============================================================================
  149. // ConnectStations
  150. // ============================================================================
  151. [STATE ConnectStations]    
  152.     TutorialTextID = 509
  153.     ReturnState = 'WaitForConnecting'
  154.     SetState("Show_tutorial_text")
  155.  
  156. [STATE WaitForInsertRoute]
  157.     IF IsEnterState
  158.     THEN
  159.         ClearCommandQueue()
  160.     END
  161.  
  162.     // Is there a queued command ? 
  163.     IF GetCommandQueueLength() > 0
  164.     THEN
  165.         IF NextCommand.GetType() == 6 AND
  166.             NextCommand.GetInternType() == 1
  167.         THEN    
  168.             NextCommand.Run()
  169.             SetState("WaitForConnecting")
  170.         ELSE
  171.             NextCommand.Cancel()
  172.             ClearCommandQueue()
  173.             SetState("ConnectStations")
  174.         END
  175.     END
  176.  
  177. [STATE WaitForConnecting]
  178.     IF AreConnected(Station1ID, Station2ID) > 0
  179.     THEN
  180.         SetState("AddRepairPlace")
  181.     ELSE
  182.         SetState("WaitForInsertRoute")
  183.     END
  184.  
  185. // ============================================================================
  186. // AddRepairPlace
  187. // ============================================================================
  188. [STATE AddRepairPlace]    
  189.     TutorialTextID = 512
  190.     ReturnState = 'WaitForRepairPlace'
  191.     SetState("Show_tutorial_text")
  192.  
  193. [STATE WaitForRepairPlace]
  194.     IF IsEnterState
  195.     THEN
  196.         ClearCommandQueue()
  197.     END
  198.  
  199.     // Is there a queued command ? 
  200.     IF GetCommandQueueLength() > 0
  201.     THEN
  202.         IF NextCommand.GetType() == 43 
  203.         THEN    
  204.             NextCommand.Run()
  205.             SetState("CloseBuildingDlg")
  206.         ELSE
  207.             NextCommand.Cancel()
  208.             ClearCommandQueue()
  209.             SetState("ConnectStations")
  210.         END
  211.     END
  212.  
  213.  
  214. // ============================================================================
  215. // Close building dialog.
  216. // ============================================================================
  217. [STATE CloseBuildingDlg]
  218.     TutorialTextID = 515
  219.     ReturnState = 'WaitForBuildClose'
  220.     SetState("Show_tutorial_text")
  221.  
  222. [STATE WaitForBuildClose]
  223.     IF BuildDialog.IsOpen() == 0
  224.     THEN
  225.         SetState("BuyTrain")
  226.     END
  227.  
  228. // ============================================================================
  229. // BuyTrain
  230. // ============================================================================
  231. [STATE BuyTrain]    
  232.     TutorialTextID = 518
  233.     ReturnState = 'WaitForBuyTrainDlg'
  234.     SetState("Show_tutorial_text")
  235.  
  236. [STATE WaitForBuyClose]
  237.     IF BuyVehicleDialog.IsOpen() == 0
  238.     THEN
  239.         SetState("WaitForBuyTrainDlg")
  240.     END
  241.  
  242. [STATE WaitForBuyTrainDlg] 
  243.     IF BuyVehicleDialog.IsOpen() == 1
  244.     THEN
  245.         IF BuyVehicleDialog.GetStation() == Station1ID
  246.         THEN
  247.             TutorialTextID = 521
  248.             ReturnState = 'WaitForAccept'
  249.             SetState("Show_tutorial_text")
  250.         ELSE
  251.             TutorialTextID = 603
  252.             ReturnState = 'WaitForBuyClose'
  253.             SetState("Show_tutorial_text")
  254.         END
  255.     END
  256.  
  257. [STATE WaitForAccept]
  258.     IF IsEnterState
  259.     THEN
  260.         IF GetCommandQueueLength() > 0
  261.         THEN
  262.             IF NextCommand.GetType() <> 10
  263.             THEN    
  264.                 ClearCommandQueue()
  265.             END
  266.         END
  267.     END
  268.  
  269.     // Is there a queued command ? 
  270.     IF GetCommandQueueLength() > 0
  271.     THEN
  272.         IF NextCommand.GetType() == 10
  273.         THEN    
  274.             NextCommand.Run()
  275.             SetState("PreSchedule")
  276.         ELSE
  277.             NextCommand.Cancel()
  278.             ClearCommandQueue()
  279.             SetState("BuyTrain")
  280.         END
  281.     ELSE
  282.         IF BuyVehicleDialog.IsOpen() == 0
  283.         THEN
  284.             SetState("BuyTrain")
  285.         END
  286.     END
  287.  
  288.  
  289. // ============================================================================
  290. // Schedule
  291. // ============================================================================
  292. [STATE PreSchedule]    
  293.     IF ScheduleDialog.IsOpen() == 1
  294.     THEN
  295.         SetState("Schedule")
  296.     END
  297.  
  298. [STATE Schedule]
  299.     FirstTutorialTextID = 524
  300.     LastTutorialTextID  = 525
  301.     ReturnState = 'WaitForFill'
  302.     SetState("Show_tutorial_text_serie")
  303.  
  304. [STATE WaitForFill]
  305.     IF ScheduleDialog.IsOpen() == 0
  306.     THEN
  307.         SetState("BuyTrain")
  308.     ELSE
  309.         IF ScheduleDialog.IsFilled(0, 39, 4) == 1
  310.         THEN
  311.             TutorialTextID = 527
  312.             ReturnState = 'WaitForWaitUntilFull'
  313.             SetState("Show_tutorial_text")
  314.         END
  315.     END
  316.  
  317. [STATE WaitForWaitUntilFull]
  318.     IF ScheduleDialog.IsOpen() == 0
  319.     THEN
  320.         SetState("BuyTrain")
  321.     ELSE
  322.         IF ScheduleDialog.GetWaitUntilFull(0) == 1
  323.         THEN    
  324.             TutorialTextID = 530
  325.             ReturnState = 'WaitForOtherStation'
  326.             SetState("Show_tutorial_text")
  327.         END
  328.     END
  329.  
  330. [STATE WaitForOtherStation]
  331.     IF ScheduleDialog.IsOpen() == 0
  332.     THEN
  333.         SetState("BuyTrain")
  334.     ELSE
  335.         IF ScheduleDialog.GetNrStations() == 2
  336.         THEN
  337.             TutorialTextID = 531
  338.             ReturnState = 'WaitForAcceptDialog'
  339.             SetState("Show_tutorial_text")
  340.         END
  341.     END
  342.     
  343. [STATE WaitForAcceptDialog]
  344.     IF IsEnterState
  345.     THEN
  346.         ClearCommandQueue()
  347.     END
  348.  
  349.     // Is there a queued command ? 
  350.     IF GetCommandQueueLength() > 0
  351.     THEN
  352.         IF NextCommand.GetType() == 15
  353.         THEN    
  354.             NextCommand.Run()
  355.             SetState("MissionGoal")
  356.         ELSE
  357.             NextCommand.Cancel()
  358.             ClearCommandQueue()
  359.             SetState("BuyTrain")
  360.         END
  361.     ELSE
  362.         IF ScheduleDialog.IsOpen() == 0
  363.         THEN
  364.             SetState("BuyTrain")
  365.         END
  366.     END
  367.  
  368. // ============================================================================
  369. // BuildHarbour1
  370. // ============================================================================
  371. [STATE BuildHarbour1]    
  372.     TutorialTextID = 533
  373.     ReturnState = 'WaitForHarbour1'
  374.     SetState("Show_tutorial_text")
  375.  
  376. [STATE WaitForHarbour1]    
  377.     IF IsEnterState
  378.     THEN
  379.         ClearCommandQueue()
  380.     END
  381.  
  382.     // Is there a queued command ? 
  383.     IF GetCommandQueueLength() > 0
  384.     THEN
  385.         IF NextCommand.GetType() == 9 AND
  386.             NextCommand.GetInternType() == 2
  387.         THEN    
  388.             SetState("VerifyHarbour1Location")
  389.         ELSE
  390.             NextCommand.Cancel()
  391.             ClearCommandQueue()
  392.             SetState("BuildHarbour1")
  393.         END
  394.     END
  395.  
  396. [STATE VerifyHarbour1Location]
  397.     IF IsHighlighted(Storage2ID)
  398.     THEN
  399.         NextCommand.Run()
  400.         Station3ID = User.GetLastBuildingBuilt()
  401.         ClearCommandQueue()
  402.         SetState("BuildHarbour2")
  403.     ELSE
  404.         TutorialTextID = 600
  405.         ReturnState = 'WaitForHarbour1'
  406.         SetState("Show_tutorial_text")
  407.     END
  408.  
  409. // ============================================================================
  410. // BuildHarbour2
  411. // ============================================================================
  412. [STATE BuildHarbour2]    
  413.     TutorialTextID = 536
  414.     ReturnState = 'WaitForHarbour2'
  415.     SetState("Show_tutorial_text")
  416.  
  417. [STATE WaitForHarbour2]    
  418.     IF IsEnterState
  419.     THEN
  420.         ClearCommandQueue()
  421.     END
  422.  
  423.     // Is there a queued command ? 
  424.     IF GetCommandQueueLength() > 0
  425.     THEN
  426.         IF NextCommand.GetType() == 9 AND
  427.             NextCommand.GetInternType() == 2
  428.         THEN    
  429.             SetState("VerifyHarbour2Location")
  430.         ELSE
  431.             NextCommand.Cancel()
  432.             ClearCommandQueue()
  433.             SetState("BuildHarbour2")
  434.         END
  435.     END
  436.  
  437. [STATE VerifyHarbour2Location]
  438.     IF IsHighlighted(Storage3ID)
  439.     THEN
  440.         NextCommand.Run()
  441.         Station4ID = User.GetLastBuildingBuilt()
  442.         ClearCommandQueue()
  443.         SetState("CloseBuildingDlg_2")
  444.     ELSE
  445.         TutorialTextID = 600
  446.         ReturnState = 'WaitForHarbour2'
  447.         SetState("Show_tutorial_text")
  448.     END
  449.  
  450. // ============================================================================
  451. // Close building dialog.
  452. // ============================================================================
  453. [STATE CloseBuildingDlg_2]
  454.     TutorialTextID = 530
  455.     ReturnState = 'WaitForBuildClose_2'
  456.     SetState("Show_tutorial_text")
  457.  
  458. [STATE WaitForBuildClose_2]
  459.     IF BuildDialog.IsOpen() == 0
  460.     THEN
  461.         SetState("BuyShip")
  462.     END
  463.  
  464. // ============================================================================
  465. // BuyShip
  466. // ============================================================================
  467. [STATE BuyShip]    
  468.     TutorialTextID = 539
  469.     ReturnState = 'WaitForBuyShipDlg'
  470.     SetState("Show_tutorial_text")
  471.  
  472. [STATE WaitForBuyClose_2]
  473.     IF BuyVehicleDialog.IsOpen() == 0
  474.     THEN
  475.         SetState("WaitForBuyShipDlg")
  476.     END
  477.  
  478. [STATE WaitForBuyShipDlg] 
  479.     IF BuyVehicleDialog.IsOpen() == 1
  480.     THEN
  481.         IF BuyVehicleDialog.GetStation() == Station3ID
  482.         THEN
  483.             TutorialTextID = 542
  484.             ReturnState = 'WaitForAccept_2'
  485.             SetState("Show_tutorial_text")
  486.         ELSE
  487.             TutorialTextID = 603
  488.             ReturnState = 'WaitForBuyClose_2'
  489.             SetState("Show_tutorial_text")
  490.         END
  491.     END
  492.  
  493. [STATE WaitForAccept_2]
  494.     IF IsEnterState
  495.     THEN
  496.         ClearCommandQueue()
  497.     END
  498.  
  499.     // Is there a queued command ? 
  500.     IF GetCommandQueueLength() > 0
  501.     THEN
  502.         IF NextCommand.GetType() == 10
  503.         THEN    
  504.             NextCommand.Run()
  505.             SetState("Schedule_2")
  506.         ELSE
  507.             NextCommand.Cancel()
  508.             ClearCommandQueue()
  509.             SetState("BuyShip")
  510.         END
  511.     ELSE
  512.         IF BuyVehicleDialog.IsOpen() == 0
  513.         THEN
  514.             SetState("BuyShip")
  515.         END
  516.     END
  517.  
  518.  
  519. // ============================================================================
  520. // Schedule
  521. // ============================================================================
  522. [STATE Schedule_2]
  523.     TutorialTextID = 545
  524.     ReturnState = 'WaitForFill_2'
  525.     SetState("Show_tutorial_text")
  526.  
  527. [STATE WaitForFill_2]
  528.     IF ScheduleDialog.IsOpen() == 0
  529.     THEN
  530.         SetState("BuyShip")
  531.     ELSE
  532.         IF ScheduleDialog.IsFilled(0, 39, 12) == 1
  533.         THEN
  534.             TutorialTextID = 548
  535.             ReturnState = 'WaitForWaitUntilFull_2'
  536.             SetState("Show_tutorial_text")
  537.         END
  538.     END
  539.  
  540. [STATE WaitForWaitUntilFull_2]
  541.     IF ScheduleDialog.IsOpen() == 0
  542.     THEN
  543.         SetState("BuyShip")
  544.     ELSE
  545.         IF ScheduleDialog.GetWaitUntilFull(0) == 1
  546.         THEN    
  547.             TutorialTextID = 551
  548.             ReturnState = 'WaitForOtherStation_2'
  549.             SetState("Show_tutorial_text")
  550.         END
  551.     END
  552.  
  553. [STATE WaitForOtherStation_2]
  554.     IF ScheduleDialog.IsOpen() == 0
  555.     THEN
  556.         SetState("BuyShip")
  557.     ELSE
  558.         IF ScheduleDialog.GetNrStations() == 2
  559.         THEN
  560.             TutorialTextID = 554
  561.             ReturnState = 'WaitForAcceptDialog_2'
  562.             SetState("Show_tutorial_text")
  563.         END
  564.     END
  565.     
  566. [STATE WaitForAcceptDialog_2]
  567.     IF IsEnterState
  568.     THEN
  569.         ClearCommandQueue()
  570.     END
  571.  
  572.     // Is there a queued command ? 
  573.     IF GetCommandQueueLength() > 0
  574.     THEN
  575.         IF NextCommand.GetType() == 15
  576.         THEN    
  577.             NextCommand.Run()
  578.             SetState("BuildTerminal1")
  579.         ELSE
  580.             NextCommand.Cancel()
  581.             ClearCommandQueue()
  582.             SetState("BuyShip")
  583.         END
  584.     ELSE
  585.         IF ScheduleDialog.IsOpen() == 0
  586.         THEN
  587.             SetState("BuyShip")
  588.         END
  589.     END
  590.  
  591. // ============================================================================
  592. // BuildTerminal1
  593. // ============================================================================
  594. [STATE BuildTerminal1]    
  595.     TutorialTextID = 557
  596.     ReturnState = 'WaitForTerminal1'
  597.     SetState("Show_tutorial_text")
  598.  
  599. [STATE WaitForTerminal1]    
  600.     IF IsEnterState
  601.     THEN
  602.         ClearCommandQueue()
  603.     END
  604.  
  605.     // Is there a queued command ? 
  606.     IF GetCommandQueueLength() > 0
  607.     THEN
  608.         IF NextCommand.GetType() == 9 AND
  609.             NextCommand.GetInternType() == 15
  610.         THEN    
  611.             SetState("VerifyTerminal1Location")
  612.         ELSE
  613.             NextCommand.Cancel()
  614.             ClearCommandQueue()
  615.             SetState("BuildTerminal1")
  616.         END
  617.     END
  618.  
  619. [STATE VerifyTerminal1Location]
  620.     IF IsHighlighted(Storage3ID)
  621.     THEN
  622.         NextCommand.Run()
  623.         Station5ID = User.GetLastBuildingBuilt()
  624.         ClearCommandQueue()
  625.         SetState("BuildTerminal2")
  626.     ELSE
  627.         TutorialTextID = 600
  628.         ReturnState = 'WaitForTerminal1'
  629.         SetState("Show_tutorial_text")
  630.     END
  631.  
  632. // ============================================================================
  633. // BuildStation2
  634. // ============================================================================
  635. [STATE BuildTerminal2]    
  636.     TutorialTextID = 560
  637.     ReturnState = 'WaitForTerminal2'
  638.     SetState("Show_tutorial_text")
  639.  
  640. [STATE WaitForTerminal2]    
  641.     IF IsEnterState
  642.     THEN
  643.         ClearCommandQueue()
  644.     END
  645.  
  646.     // Is there a queued command ? 
  647.     IF GetCommandQueueLength() > 0
  648.     THEN
  649.         IF NextCommand.GetType() == 9 AND
  650.             NextCommand.GetInternType() == 15
  651.         THEN    
  652.             SetState("VerifyTerminal2Location")
  653.         ELSE
  654.             NextCommand.Cancel()
  655.             ClearCommandQueue()
  656.             SetState("BuildTerminal2")
  657.         END
  658.     END
  659.  
  660. [STATE VerifyTerminal2Location]
  661.     IF IsHighlighted(Storage4ID)
  662.     THEN
  663.         NextCommand.Run()
  664.         Station6ID = User.GetLastBuildingBuilt()
  665.         ClearCommandQueue()
  666.         SetState("ConnectStations_2")
  667.     ELSE
  668.         TutorialTextID = 600
  669.         ReturnState = 'WaitForStation2'
  670.         SetState("Show_tutorial_text")
  671.     END
  672.  
  673. // ============================================================================
  674. // ConnectStations
  675. // ============================================================================
  676. [STATE ConnectStations_2] 
  677.     IF AreConnected(Station5ID, Station6ID) > 0
  678.     THEN
  679.         SetState("CloseBuildingDlg_3")
  680.     ELSE
  681.         TutorialTextID = 563
  682.         ReturnState = 'WaitForConnecting_2'
  683.         SetState("Show_tutorial_text")
  684.     END
  685.  
  686. [STATE WaitForInsertRoute_2]
  687.     IF IsEnterState
  688.     THEN
  689.         ClearCommandQueue()
  690.     END
  691.  
  692.     // Is there a queued command ? 
  693.     IF GetCommandQueueLength() > 0
  694.     THEN
  695.         IF NextCommand.GetType() == 6 AND
  696.             NextCommand.GetInternType() == 4
  697.         THEN    
  698.             NextCommand.Run()
  699.             SetState("WaitForConnecting_2")
  700.         ELSE
  701.             NextCommand.Cancel()
  702.             ClearCommandQueue()
  703.             SetState("ConnectStations_2")
  704.         END
  705.     END
  706.  
  707. [STATE WaitForConnecting_2]
  708.     IF AreConnected(Station5ID, Station6ID) > 0
  709.     THEN
  710.         SetState("CloseBuildingDlg_3")
  711.     ELSE
  712.         SetState("WaitForInsertRoute_2")
  713.     END
  714.  
  715.  
  716. // ============================================================================
  717. // Close building dialog.
  718. // ============================================================================
  719. [STATE CloseBuildingDlg_3]
  720.     TutorialTextID = 530
  721.     ReturnState = 'WaitForBuildClose_3'
  722.     SetState("Show_tutorial_text")
  723.  
  724. [STATE WaitForBuildClose_3]
  725.     IF BuildDialog.IsOpen() == 0
  726.     THEN
  727.         SetState("BuyLorry")
  728.     END
  729.  
  730. // ============================================================================
  731. // BuyTrain
  732. // ============================================================================
  733. [STATE BuyLorry]    
  734.     TutorialTextID = 566
  735.     ReturnState = 'WaitForBuyLorryDlg'
  736.     SetState("Show_tutorial_text")
  737.  
  738. [STATE WaitForBuyClose_3]
  739.     IF BuyVehicleDialog.IsOpen() == 0
  740.     THEN
  741.         SetState("WaitForBuyLorryDlg")
  742.     END
  743.  
  744. [STATE WaitForBuyLorryDlg] 
  745.     IF BuyVehicleDialog.IsOpen() == 1
  746.     THEN
  747.         IF BuyVehicleDialog.GetStation() == Station5ID
  748.         THEN
  749.             TutorialTextID = 569
  750.             ReturnState = 'WaitForAccept_3'
  751.             SetState("Show_tutorial_text")
  752.         ELSE
  753.             TutorialTextID = 603
  754.             ReturnState = 'WaitForBuyClose_3'
  755.             SetState("Show_tutorial_text")
  756.         END
  757.     END
  758.  
  759. [STATE WaitForAccept_3]
  760.     IF IsEnterState
  761.     THEN
  762.         ClearCommandQueue()
  763.     END
  764.  
  765.     // Is there a queued command ? 
  766.     IF GetCommandQueueLength() > 0
  767.     THEN
  768.         IF NextCommand.GetType() == 10
  769.         THEN    
  770.             NextCommand.Run()
  771.             SetState("Schedule_3")
  772.         ELSE
  773.             NextCommand.Cancel()
  774.             ClearCommandQueue()
  775.             SetState("BuyLorry")
  776.         END
  777.     ELSE
  778.         IF BuyVehicleDialog.IsOpen() == 0
  779.         THEN
  780.             SetState("BuyLorry")
  781.         END
  782.     END
  783.  
  784.  
  785. // ============================================================================
  786. // Schedule
  787. // ============================================================================
  788. [STATE Schedule_3]
  789.     TutorialTextID = 572
  790.     ReturnState = 'WaitForFill_3'
  791.     SetState("Show_tutorial_text")
  792.  
  793. [STATE WaitForFill_3]
  794.     IF ScheduleDialog.IsOpen() == 0
  795.     THEN
  796.         SetState("BuyLorry")
  797.     ELSE
  798.         IF ScheduleDialog.IsFilled(0, 39, 1) == 1
  799.         THEN
  800.             TutorialTextID = 575
  801.             ReturnState = 'WaitForWaitUntilFull_3'
  802.             SetState("Show_tutorial_text")
  803.         END
  804.     END
  805.  
  806. [STATE WaitForWaitUntilFull_3]
  807.     IF ScheduleDialog.IsOpen() == 0
  808.     THEN
  809.         SetState("BuyLorry")
  810.     ELSE
  811.         IF ScheduleDialog.GetWaitUntilFull(0) == 1
  812.         THEN    
  813.             TutorialTextID = 578
  814.             ReturnState = 'WaitForOtherStation_3'
  815.             SetState("Show_tutorial_text")
  816.         END
  817.     END
  818.  
  819. [STATE WaitForOtherStation_3]
  820.     IF ScheduleDialog.IsOpen() == 0
  821.     THEN
  822.         SetState("BuyLorry")
  823.     ELSE
  824.         IF ScheduleDialog.GetNrStations() == 2
  825.         THEN
  826.             TutorialTextID = 581
  827.             ReturnState = 'WaitForAcceptDialog_3'
  828.             SetState("Show_tutorial_text")
  829.         END
  830.     END
  831.     
  832. [STATE WaitForAcceptDialog_3]
  833.     IF IsEnterState
  834.     THEN
  835.         ClearCommandQueue()
  836.     END
  837.  
  838.     // Is there a queued command ? 
  839.     IF GetCommandQueueLength() > 0
  840.     THEN
  841.         IF NextCommand.GetType() == 15
  842.         THEN    
  843.             NextCommand.Run()
  844.             SetState("MissionGoal")
  845.         ELSE
  846.             NextCommand.Cancel()
  847.             ClearCommandQueue()
  848.             SetState("BuyLorry")
  849.         END
  850.     ELSE
  851.         IF ScheduleDialog.IsOpen() == 0
  852.         THEN
  853.             SetState("BuyLorry")
  854.         END
  855.     END
  856.  
  857.  
  858. // ============================================================================
  859. // MISSION GOAL
  860. // ============================================================================
  861. [STATE MissionGoal]
  862.     FirstTutorialTextID = 533
  863.     LastTutorialTextID  = 534
  864.     ReturnState = 'End'
  865.     SetState("Show_tutorial_text_serie")
  866.  
  867.  
  868. // ============================================================================
  869. // END
  870. // ============================================================================
  871. [STATE End]
  872.  
  873.     IF IsEnterState
  874.     THEN
  875.         StopCommandFiltering()
  876.     END
  877.  
  878.     // Otherwise do nothing ... 
  879.  
  880.  
  881. // ============================================================================
  882. // HELPER STATES
  883. // 
  884. // Here are some states, which are used to do repetitive tasks.
  885. // ============================================================================
  886. //-----------------------------------------------------------------------------
  887. // Show_tutorial_text
  888. // - Opens tutorial text
  889. // - Waits until it is closed
  890. // - Returns to the return state
  891. // ----------------------------------------------------------------------------
  892. [STATE Show_tutorial_text]
  893.  
  894.     IF IsEnterState
  895.     THEN
  896.         TutorialText.Show(TutorialTextID)
  897.     ELSE
  898.         IF TutorialText.IsOpen() == 0
  899.         THEN 
  900.             SetState(ReturnState)
  901.         END
  902.     END
  903.  
  904. //-----------------------------------------------------------------------------
  905. // Show_tutorial_text_serie
  906. // - Shows a serie of tutorial texts from FirstTutorialTextID to LastTutorialTextID
  907. // ----------------------------------------------------------------------------
  908. [STATE Show_tutorial_text_serie]
  909.  
  910.     IF IsEnterState
  911.     THEN
  912.         Local_i = FirstTutorialTextID
  913.         TutorialText.Show(FirstTutorialTextID)
  914.     ELSE
  915.         IF TutorialText.IsOpen() == 0
  916.         THEN 
  917.             Local_i = Local_i + 1
  918.             
  919.             IF Local_i > LastTutorialTextID
  920.             THEN
  921.                 SetState(ReturnState)
  922.             ELSE
  923.                 TutorialText.Show(Local_i)
  924.             END
  925.         END
  926.     END
  927.  
  928.  
  929.